package fizzpicks.tetrapulp;

import pulpcore.scene.Scene2D;
import pulpcore.sprite.Label;
import pulpcore.sprite.FilledSprite;
import pulpcore.sprite.ImageSprite;
import static pulpcore.image.Colors.WHITE;
import pulpcore.Input;
import net.jscience.math.MathFP;
import fizzpicks.tetrapulp.tetrapulp.LJInput;

/**
 * Created by will
 * Date: May 4, 2008 1:07:07 AM
 */
public class TetraPulp extends Scene2D {

    LJTester test;
    LJViewSprite view;
    @Override
    public void load() {
        MathFP.setPrecision(16);
        add(new FilledSprite(WHITE));
        add(new ImageSprite("success.png", 5, 5));
        add(new Label("Hello World!", 26, 6));
        test = new LJTester();
        test.init();
        view = new LJViewSprite(0,0,800,600, LJTester.view);
        add(view);
        test.play();
    }

    @Override
    public void update(int elapsedTime) {
        LJInput in = new LJInput();
        if(Input.isDown(Input.KEY_LEFT)) {
            in.movement = -1;
        }
        if(Input.isDown(Input.KEY_RIGHT)) {
            in.movement = 1;
        }
        if(Input.isDown(Input.KEY_DOWN)) {
            in.gravity = 1;
        }
        if(Input.isPressed(Input.KEY_UP)) {
            in.rotation = 1;
        }
//        if(Input.isMousePressed()) {
            test.playFrame(false,elapsedTime, in);
//        }
    }
}
